#ifndef HPLC_ZKYS_MAKEPACKET_H
#define HPLC_ZKYS_MAKEPACKET_H

#include <QByteArray>
#include "basesendpacket.h"

namespace hplc
{
namespace zkys
{
class HplcZkysProtocolCommonData;
class HplcZkysMakePacket
{
public:
    HplcZkysMakePacket(HplcZkysProtocolCommonData &data);

    void makeGlobalPacket(quint8 pfc);
    void makeGlobalPacket(quint8 pfc, quint8 para);

    void makePacket(quint8 pfc);
    void makePacket(quint8 pfc, quint8 para);
    void makePacket(quint8 pfc, quint16 para);
    void makePacket(quint8 pfc, quint8 para, quint8 para2);
    void makePacket(quint8 pfc, quint8 para, quint8 para2, qint32 para3);
    void makePacket(quint8 pfc, quint8 para, quint32 para2);
    void makePacket(quint8 pfc, quint16 para, quint16 para2);
    void makePacket(quint8 pfc, quint16 para, quint16 para2, quint8 para3);
    void makePacket(quint8 pfc, quint32 para);
    void makePacket(quint8 pfc, float para);
    void makePacket(quint8 pfc, float para, float para2);
    void makePacket(quint8 pfc, float para, float para2, float para3);
    void makePacket(quint8 pfc, char *str);
    void makePacket(quint8 pfc, quint8 para, char *str);
    void makePacket(quint8 pfc, quint8 para, float para2);
    void makePacket(quint8 pfc, quint8 para, quint8 para2, quint32 para3);
    void makePacket(quint8 pfc, quint8 para, float para2, float para3);
    void makePacket(quint8 pfc, quint8 para, float para2, float para3, float para4);
    void makePacket(quint8 pfc, quint8 para, float para2, quint8 para3);
    void makePacket(quint8 pfc, quint8 para, quint8 para2, quint8 para3);
    void makePacket(quint8 pfc, quint8 para, quint16 para2);
    void makePacket(quint8 pfc, quint8 para, qint32 para2);

private:
    void append2Bytes(char *para);
    void append4Bytes(char *para);
    void appendString(char *para);
    void addCRC();
    void escape();
    void addHeadAndTail();

    void preMakePacket();
    void postMakePacket();

    HplcZkysProtocolCommonData *m_d = nullptr;
};

} // zkys
} // hplc

#endif // HPLC_ZKYS_MAKEPACKET_H
